// headers from this project
#include "prototype.hpp"

// headers from standard libraries
#include <iostream>

DesignPatterns::car_record::
car_record(std::string car_name, int id)
        : DesignPatterns::record::record()
        , m_car_name(car_name)
        , m_car_id(id)
{
}

DesignPatterns::car_record::
car_record(DesignPatterns::car_record& car) 
        : DesignPatterns::record::record()
{
        m_car_name = car.m_car_name;
        m_car_id = car.m_car_id;
}

void DesignPatterns::car_record::
print()
{
        std::cout << "Car" << std::endl;
        std::cout << "Name : " << m_car_name << std::endl; 
        std::cout << "Number : " << m_car_id << std::endl; 
}

DesignPatterns::record* 
DesignPatterns::car_record::
clone()
{
        return new car_record(*this);
}


DesignPatterns::bike_record::
bike_record(std::string bike_name, int id)
        : DesignPatterns::record::record()
        , m_bike_name(bike_name)
        , m_bike_id(id)
{
}

DesignPatterns::bike_record::
bike_record(DesignPatterns::bike_record& bike) 
        : DesignPatterns::record::record()
{
        m_bike_name = bike.m_bike_name;
        m_bike_id = bike.m_bike_id;
}

void DesignPatterns::bike_record::
print()
{
        std::cout << "Bike" << std::endl;
        std::cout << "Name : " << m_bike_name << std::endl; 
        std::cout << "Number : " << m_bike_id << std::endl; 
}

DesignPatterns::record* 
DesignPatterns::bike_record::
clone()
{
        return new bike_record(*this);
}


DesignPatterns::plane_record::
plane_record(std::string plane_name, int id)
        : DesignPatterns::record::record()
        , m_plane_name(plane_name)
        , m_plane_id(id)
{
}

DesignPatterns::plane_record::
plane_record(DesignPatterns::plane_record& plane) 
        : DesignPatterns::record::record()
{
        m_plane_name = plane.m_plane_name;
        m_plane_id = plane.m_plane_id;
}

void DesignPatterns::plane_record::
print()
{
        std::cout << "Plane" << std::endl;
        std::cout << "Name : " << m_plane_name << std::endl; 
        std::cout << "Number : " << m_plane_id << std::endl; 
}

DesignPatterns::record* 
DesignPatterns::plane_record::
clone()
{
        return new plane_record(*this);
}

DesignPatterns::client::
client()
{
        m_record[CAR] = new DesignPatterns::car_record("Ferrari", 5050);
        m_record[BIKE] = new DesignPatterns::bike_record("Yamaha", 2525);
        m_record[PLANE] = new DesignPatterns::plane_record("Boeing", 25);
}

DesignPatterns::client::
~client()
{
        delete m_record[CAR];
        delete m_record[BIKE];
        delete m_record[PLANE];
}

DesignPatterns::record*
DesignPatterns::client::
create_record(record_type type)
{
        return m_record[type]->clone();
}
